import { ecs } from 'db://app-game/libs/ecs/ECS';
import { ECSEntity } from 'db://app-game/libs/ecs/ECSEntity';
import { LevelMapModelComp } from '../model/LevelMapModelComp';
import { LevelMap } from '../LevelMap';
import { TiledMap } from 'cc';

/** 图系统 */
@ecs.register('Graph')
export class GraphSystem extends ecs.ComblockSystem implements ecs.IEntityEnterSystem {
  filter(): ecs.IMatcher {
    return ecs.allOf(LevelMapModelComp);
  }
  entityEnter(levelMap: LevelMap) {}

  async loadMap(levelMap: LevelMap) {
    const lmm = levelMap.LevelMapModel;

    for (let row = 0; row < lmm.tileRowNumber; ++row) {
      for (let col = 0; col < lmm.tileColNumber; ++col) {
        const node = await levelMap.createMapNode(row, col);
        const tiledMap = node.getComponent(TiledMap);
      }
    }

    lmm.mapTable;
  }
}
